package com.ssy.lingxi.report.repository.settleaccount;

import com.ssy.lingxi.report.entity.settleaccount.PlatformSettlementDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 平台结算
 * @author 伍将
 * @date 2020/12/14
 * @version 2.0.0
 */
public interface PlatformSettlementRepository extends JpaRepository<PlatformSettlementDO, Long>, JpaSpecificationExecutor<PlatformSettlementDO> {

    @Query(value = "SELECT * FROM sa_platform_settlement " +
            " WHERE settlement_date=:settlementDate" +
            " AND member_id=:memberId AND role_id=:roleId" +
            " AND settlement_Way=:settlementWay", nativeQuery = true)
    PlatformSettlementDO getDetail(Long settlementDate, Long memberId, Long roleId, Integer settlementWay);

    List<PlatformSettlementDO> findAllByIdGreaterThanEqualAndMemberIdAndRoleIdOrderBySettlementDateAsc(Long id, Long memberId, Long roleId);
}
